package com.rockfalldefence.sw.embark.client.page;

import net.binarymuse.gwt.client.ui.wizard.WizardPage;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.rockfalldefence.sw.embark.client.RDEmbarkContext;

public class VerifichePage extends WizardPage<RDEmbarkContext> {
	public static final PageID PAGEID = new PageID();
	private FlowPanel panel;
	
	public VerifichePage() {
		panel = new FlowPanel();

	    panel.add(new HTML("<h1>Verifica delle Fondazioni (SLU)</h1><br/>"));

	    Image img = new Image("images/trapezio_fondazioni.png");

	    HorizontalPanel hp = new HorizontalPanel();
	    hp.add(img);
	    VerticalPanel vp = new VerticalPanel();
	    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	    FlexTable t = new FlexTable();

	    t.setHTML(0, 0, "<b>Azioni di progetto</b>");
	    t.setHTML(0, 1, "<b>Valori</b>");
	    t.setHTML(0, 2, "");
	    TextBox tbx = new TextBox();
	    tbx.setWidth("38px");
	    Label lbl = new Label();
	    tbx.setValue("547");
	    lbl.setText("Momento (kN*m/m)");
	    t.setWidget(1, 0, lbl);
	    t.setWidget(1, 1, tbx);
	    t.setHTML(1, 2, "[M]");
	    
	    tbx = new TextBox();
	    lbl = new Label();
	    tbx.setValue("832");
	    tbx.setWidth("38px");
	    lbl.setText("Assiale (kN/m)");
	    t.setWidget(2, 0, lbl);
	    t.setWidget(2, 1, tbx);
	    t.setHTML(2, 2, "[N]");
	    
	    tbx = new TextBox();
	    lbl = new Label();
	    tbx.setValue("374");
	    tbx.setWidth("38px");
	    lbl.setText("Tangenziale (kN/m)");
	    t.setWidget(3, 0, lbl);
	    t.setWidget(3, 1, tbx);
	    t.setHTML(3, 2, "[T]");
	    Button btn = new Button();
	    btn.setText("Relazione");
	    btn.setTitle("Scarica la relazione relativa alle verifiche eseguite");
	    btn.addClickHandler(new ClickHandler() {
			
			@Override
			public void onClick(ClickEvent event) {
				Window.alert("Coming soon!");
				
			}
		});
	    vp.add(t);
	    vp.add(new HTML("<br/>"));
	    vp.add(btn);
	    hp.add(vp);
	    panel.add(hp);
	    
	}


	@Override
	public Widget asWidget() {
		
		return panel;
	}

	@Override
	public PageID getPageID() {
		return PAGEID;
	}

	@Override
	public String getTitle() {
		return "Verifiche Fondazioni";
	}

}
